#include "Entity.h"

void VerletBodyEntity::update(Scalar fTimeStep)
{
	
public:
	
	//Integrate the position of each Point
	for (PointIterator itP=m_pPoints.begin();itP!=m_pPoints.end();++itP) {
		//if (!m_pPoints[i]->bIsStatic) {
			//Verlet algorithm
			Vector vNewPos = 2 * itP->vPos - itP->vOldPos + (itP->vForce / itP->fMass) * fTimeStep * fTimeStep;
			itP->vOldPos = itP->vPos;
		 	itP->vPos = vNewPos;
		 	//itP->vForce = Vector3D(0, itP->fMass * -GRAVITY, 0);
		 	itP->vForce.zero();
		//}
	}
	
	
	
};
